package com.jbit.dm212.controller;

import com.jbit.dm212.common.ResponseResult;
import com.jbit.dm212.common.ResponseResultUtils;
import com.jbit.dm212.entity.dto.DmItemDTO;
import com.jbit.dm212.entity.dto.DmItemTypeDTO;
import com.jbit.dm212.entity.dto.FloorDTO;
import com.jbit.dm212.entity.dto.FloorItemDTO;
import com.jbit.dm212.entity.vo.DmItemTypeVO;
import com.jbit.dm212.service.DmItemService;
import com.jbit.dm212.service.DmItemTypeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("/item/api/p/index")
@RestController
public class DmItemIndexController {
    @Resource
    private DmItemTypeService dmItemTypeService;
    @Resource
    private DmItemService dmItemService;
    @PostMapping("/queryAllType")
    public ResponseResult<List<DmItemTypeDTO>> queryAllType(){
        return ResponseResultUtils.sendSuccess(dmItemTypeService.getAllType());
    }
    @PostMapping("/queryTransverse")
    public ResponseResult<List<DmItemTypeDTO>> queryTransverse(){
        return ResponseResultUtils.sendSuccess(dmItemTypeService.getTransverse());
    }
    @PostMapping("/queryBanner")
    public ResponseResult<List<DmItemDTO>> queryBanner(){
        return ResponseResultUtils.sendSuccess(dmItemService.getBanner());
    }
    @PostMapping("/queryTodayRecommend")
    public ResponseResult<List<DmItemDTO>> queryTodayRecommend(){
        return ResponseResultUtils.sendSuccess(dmItemService.getTodayRecommend());
    }

    @PostMapping("/queryToSaleItem")
    public ResponseResult<List<DmItemDTO>> queryToSaleItem(){
        return ResponseResultUtils.sendSuccess(dmItemService.getToSaleItem());
    }
    @PostMapping("/queryFloorItems")
    public ResponseResult<List<FloorDTO>> queryFloorItems(){
        return ResponseResultUtils.sendSuccess(dmItemTypeService.getFloorItems());
    }


    @PostMapping("/queryHotItems")
    public ResponseResult<List<FloorItemDTO>> queryHotItems(@RequestBody DmItemTypeVO itemTypeVO){
        return ResponseResultUtils.sendSuccess(dmItemService.getHotItems(itemTypeVO.getItemTypeId()));
    }
}
